// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: XYZFile.h,v 1.17.18.1 2007/03/25 21:23:42 oliver Exp $
//

#ifndef BALL_FORMAT_DYNAMOFILE_H
#define BALL_FORMAT_DYNAMOFILE_H

#ifndef BALL_FORMAT_GENERICMOLFILE_H
#   include <BALL/FORMAT/genericMolFile.h>
#endif

namespace BALL
{
class System;
class Molecule;
class AtomContainer;

/** DYNAMO file class.
        This class enables BALL to read and write XMol DYNAMO files.
        The XYZ format is a very simple molecular file format. In general it contains
        only the atom type (i.e., the element) and the cartesian coordinates
        of the structure.
        Newer versions of this file format also contain bonds (without bond order) and
        atom names.\par
        The first line of each XYZ file contains a single integer number: the number
        of atoms in the file. The second line is just a comment line. When reading a
        XYZ file, BALL stores this comment as the name attribute of the system read.
        Similarly, on writing the system, it's name is written to this comment line.
        All remaining lines contain the element symbol and the three coordinates
        in free format.  \par

    \ingroup  StructureFormats
*/
class BALL_EXPORT DYNAMOFile
    : public GenericMolFile
{
public:

    /** @name   Constructors and Destructors
    */
    //@{

    /** Default constructor
    */
    DYNAMOFile();

    /** Detailed constructor.
            Create a DYNAMO file and open it with mode <tt>open_mode</tt> (reading is default)
            @param filename the filename
            @param open_mode the openmode - default is  \link File::IN File::IN \endlink
    */
    DYNAMOFile(const String& filename, File::OpenMode open_mode = std::ios::in)
    throw(Exception::FileNotFound);

    /** Copy constructor
    */
    DYNAMOFile(const DYNAMOFile& file)
    throw(Exception::FileNotFound);

    /// Destructor
    virtual ~DYNAMOFile()
    ;

    //@}
    /** @name Reading and Writing of Kernel Datastructures
    */
    //@{

    /** Write an AtomContainer to the DYNAMO file
     */
    virtual bool write(const AtomContainer& ac)
    throw(File::CannotWrite);

    /** Write a system to the DYNAMO file
    */
    virtual bool write(const System& system)
    throw(File::CannotWrite);

    /** Write a molecule to the DYNAMO file
    */
    virtual bool write(const Molecule& mol)
    throw(File::CannotWrite);

    /** Read a system from the DYNAMO file
    */
    virtual bool read(System&   system)
    throw(Exception::ParseError);

    /** Read a molecule from the DYNAMO file
     */
    virtual Molecule* read()
    throw(Exception::ParseError);

    const DYNAMOFile& operator = (const DYNAMOFile& file)
    {
        File::operator = (file);

        return *this;
    }

    ///@deprecated Instead of this method use DYNAMOFile::getComment()
    BALL_DEPRECATED const String& getComent() const
    {
        return comment_;
    }

    ///
    const String& getComment() const
    {
        return comment_;
    }

private:

    String comment_;

    //@}
};
} // namespace BALL

#endif // BALL_FORMAT_DYNAMOFILE_H
